package com.ziyun.erp.modules.purchase.service.impl;

import io.renren.common.utils.StringUtil;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import com.ziyun.erp.modules.purchase.dao.StoreMaterialSupplierDao;
import com.ziyun.erp.modules.purchase.entity.StoreMaterialSupplierEntity;
import com.ziyun.erp.modules.purchase.service.StoreMaterialSupplierService;


@Service("storeMaterialSupplierService")
public class StoreMaterialSupplierServiceImpl extends ServiceImpl<StoreMaterialSupplierDao, StoreMaterialSupplierEntity> implements StoreMaterialSupplierService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String msName = StringUtil.getRequestParamString(params.get("msName"));
        Page<StoreMaterialSupplierEntity> page = this.selectPage(
                new Query<StoreMaterialSupplierEntity>(params).getPage(),
                new EntityWrapper<StoreMaterialSupplierEntity>()
                        .like(StringUtil.isNotEmpty(msName),"ms_name",msName)
                .orderBy("create_time",false)
        );

        return new PageUtils(page);
    }

    @Override
    public void updateByMap(Map<String, Object> map, int msId) {
        baseMapper.updateByMap(map,msId);
    }

}
